{% extends 'base.html' %}
{% block order %}
<nav class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-bookmark"></span>&nbsp;我的订单</a>
    </div>
</nav>
					<table class="table">
                    {% if order %}
                    {% for foo in order %}
                        <thead>
                        <tr>
                            <td colspan="10">
                                订单编号:{{ foo.order_id }}
                            </td>
                        </tr>
                        </thead>
						<thead>
							<tr>
								<th>
									订单日期
								</th>
                                <th>
									金额(元)
								</th>
                                <th>
									联系电话
								</th>
                                <th>
									配送地址
								</th>
                                <th>
									支付方式
								</th>
                                <th>
									订单状态
								</th>
                                <th>
									交易凭证
								</th>
                                <th>

								</th>
							</tr>
						</thead>
						<tbody style="background-color: cornsilk">

							<tr>
								<td>
                                    {{ foo.order_data }}
								</td>
								<td>
									{{ foo.order_money_all }}
								</td>
                                <td>
                                    {{ foo.tel }}
								</td>
                                <td>
                                    {{ foo.address }}
								</td>
                                <td>
                                    {{ foo.payway }}
								</td>
                                <td>
                                    {{ foo.pay_case }}
								</td>
                                <td>
                                    {{ foo.trade_no }}
								</td>
                                <td>
                                    {% if foo.pay_case == '未支付' %}
                                    <button type="button" class="btn btn-default disabled">&nbsp;支付失败</button>
                                        {% else %}
                                        <a href="/order/order_all/?id={{ foo.id }}"><button type="button" class="btn btn-default">&nbsp;评论/详情</button></a>
                                    {% endif %}
								</td>
							</tr>


						</tbody>
                        {% endfor %}
                    {% else %}
                            <tbody>
                                <tr>
                                    <td></td>
                                    <td align="center">订单空空如也~</td>
                                    <td></td>
                                </tr>
                            </tbody>
                    {% endif %}

					</table>
    <ul class="pagination pull-right">
                {% if order.has_previous %}
                <li><a href="/order/?page={{ order.previous_page_number }}">上一页</a></li>
                {% else %}
                    <li><a href="">上一页</a></li>
                {% endif %}
                {% for i in order.paginator.page_range %}
{#              判断是否为当前页,如果是当前页则普通展示并加粗#}
                {% if i == order.number %}
                <li class="active"><a href="#">{{ i }}</a></li>
{#              如果不是当前页则附带超链接展示#}
                {% else %}
{#              超链接用于点击某一页页码时候将页码传到后台#}
                <li><a href="/order/?page={{ i }}">{{ i }}</a></li>
                {% endif %}
                {% endfor %}
                {% if order.has_next %}
                <li><a href="/order/?page={{ order.next_page_number }}">下一页</a></li>
                {% else %}
                <li><a href="">下一页</a></li>
    {% endif %}
			</ul>

{% endblock order %}